package com.macro.mall.model;

import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * provincemapping实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
public class Provincemapping implements Serializable{
	/***/
    @ApiModelProperty(value = "")
	private Integer provinceid; 
	/**省份代码*/
    @ApiModelProperty(value = "省份代码")
	private String code; 
	/**省份名称*/
    @ApiModelProperty(value = "省份名称")
	private String name; 
	/**是否上线(0表示未上线,1表示已经上线)*/
    @ApiModelProperty(value = "是否上线(0表示未上线,1表示已经上线)")
	private Integer eable;

    @ApiModelProperty(value = "地市")
	private List<DomLdAreaCdProv> domLdAreaCdProv;

	/**
	 * 实例化
	 */
	public Provincemapping() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public Provincemapping(JSONObject obj) {
		this();
		if (obj.get("provinceid") instanceof Number) {
			this.setProvinceid(((Number) obj.get("provinceid")).intValue());
		}
		if (obj.get("code") instanceof String) {
			this.setCode((String) obj.get("code"));
		}
		if (obj.get("name") instanceof String) {
			this.setName((String) obj.get("name"));
		}
		if (obj.get("eable") instanceof Number) {
			this.setEable(((Number) obj.get("eable")).intValue());
		}
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getProvinceid() != null) {
			result.put("provinceid",this.getProvinceid());
		}
		if (this.getCode() != null) {
			result.put("code",this.getCode());
		}
		if (this.getName() != null) {
			result.put("name",this.getName());
		}
		if (this.getEable() != null) {
			result.put("eable",this.getEable());
		}
		return result;
	}


	@Override
	public String toString() {
		return "Provincemapping [provinceid=" + provinceid + " , code=" + code + " , name=" + name + " , eable=" + eable + "  ]";
	
	}
	
	
}
